The present invention relates generally to serial communications in a protected operating system. More particularly, the invention relates to a Windows(copyright) type operating system-based serial communications driver that time stamps each character of data received at the most privileged architectural level (Ring-zero).
A virtual device is an executable that manages a system resource, such as a hardware device or installed software, so that more than one application can use the resource at the same time. A family of operating systems sold under the tradename Windows(copyright) by Microsoft Corporation including Windows 95/98/NT/2000 uses virtual devices to allow multitasking for applications running under the operating system. The virtual devices work in conjunction with the operating system to process interrupts and carry out I/O operations for a given application without disrupting the execution of other applications. The virtual devices require virtual device drivers (VxDs). Virtual device drivers enable the operating system to present applications with an abstract interface to the hardware. By providing a standardized way of interacting with a device, the operating system shields the application programmer from the low-level hardware details. This makes application development easier, which leads to more successful applications and a more successful operating system platform.
Under the Windows(copyright) operating system, for example, VxDs are responsible for implementing an environment in which application code can successfully interact with the PC hardware. To allow users of the Windows(copyright) operating system to run multiple applications simultaneously, the system""s designers implemented virtual machines. A virtual machine is a separate environment in which an application runs. It has its own address space, register state, stacks, local descriptor table, interrupt table state, and execution priority.
Now referring to FIG. 1, a generalized diagram of a protected operating system 10 architecture, such as the Windows(copyright) operating system, is illustrated therein. Modern microprocessors have distinct modes of operation for execution of trusted system code and the execution of application code. Protected operating system 10 is structured in layers. Software applications 12 run at Ring-3, and Rings 1 and 2 are typically not used. Windows(copyright) components referred to as Device Drivers (those having the extension. DRVxe2x80x94not shown) are different from virtual device drivers, VxDs, such as the port driver VxD 14; Device Drivers are 16-bit components that run at Ring-3.
VxDs are loaded as part of the Virtual Machine Manager (VMMxe2x80x94not shown) and constitute the lowest level (Ring-0) of the protected operating system 10. The VMM (not shown) is a special VxD that plays an executive role in coordinating use of system resources. The primary job of the VMM is to create, schedule, and destroy virtual machines. In addition, it provides the services that enable other VxDs to intervene between software applications 12 and hardware, such as automotive component 20.
DOS applications, originally written for a single program environment, often attempt to directly access sensitive hardware resources, such as interrupt controllers and DMA controllers. To run multiple such applications, along with software applications 12, the protected operating system 10 must implement instances of virtual devices for each virtual machine. The task of a VxD is to manage a virtual device state for each client virtual machine that needs access to the corresponding physical device. VxDs collectively provide virtual machine environments for client applications by transparently arbitrating access to the underlying physical layer (Ring-0). This is referred to as virtualization.
Although VxDs were originally designed with the purpose of virtualization in mind, their usage has evolved to encompass additional features. Increasingly, system designers choose VxDs for maximum performance and fine control. For example, to support a device that requires low interrupt latency, a VxD is often essential. In many cases, designers handle all the actual hardware interaction in a VxD, and the VxD presents a simplified application programming interface (API) to applications.
The Virtual Communications Driver (VCOMM) 16 is the centerpiece of the current Windows(copyright) architecture for serial and parallel communications. FIG. 1 also shows the interrelationships between VCOMM 16 and other components in protected operating system 10 for a software application 12. An application program interface (API) is the interface (calling conventions) by which an application program accesses the operating system and other services. An API is defined at the source code level (Ring-0) and provides a level of abstraction between the application and the kernel (or privileged utilities) to ensure the code portability. VCOMM 16 services serial I/O requests from software applications 12 and VxD callers of its service entry points by calling a port driver VxD 14 such as serial.vxd in the Windows(copyright) operating system.
Many applications require a specific timing accuracy when communicating via the serial communications port. For example, in the automotive industry, computers 18 are often connected to an automotive component 20 to monitor its operating status. To adequately monitor status changes in the automotive component, a certain timing resolution is necessary. For example, the Society of Automotive Engineers (SAE) has defined SAE J1708 and J1587 standards requiring a timing resolution accurate to 1 millisecond (10xe2x88x923 seconds) to detect a complete packet on the serial communications bus.
The timing resolution provided by the Windows(copyright) operating system is about 55 milliseconds. Therefore, to detect the actual time each character is received in the internal buffer provided by the serial communications driver, a high accuracy time-stamp must be attached to each character received at Ring-0 level. Microsoft Network supplies serial.vxd as one of the standard Windows(copyright) operating system components, but this serial port driver does not provide a time-stamp for each character received. Therefore, a real-time virtual serial device driver must be developed for this purpose.
The present invention is a real-time virtual serial device driver that adds a time-stamp to each character received at the ring-zero level by utilizing a real-time clock. Specifically, the invention uses the VTD-Get-Real-Time service provided by the Virtual Timer Driver (VTD), thus achieving timing accuracy within microseconds.
The protected operating system includes a system registry which is a single place for keeping such information as what hardware is attached, what system options have been selected, how computer memory is set up and what application programs are to be present when the operating system is started. The present invention reads configuration settings from the system registry upon the port driver VxD being loaded. All the serial communications ports can share the port driver VxD. The J1587 network is a serial communications network that adheres to the communications standardsxe2x80x94J1587 and J1708 standards (described more fully below)xe2x80x94proscribed by the SAE. However, a time-stamp should only be attached to the characters received by the serial communications port to which the J1587 network is attached. To enable other ports to function normally, an indication from outside of the port driver VxD is needed to signal the port driver VxD to time-stamp the characters received. Using a time-stamp flag defined in the system registry 24 accomplishes this requirement.
Now referring to FIG. 4, a flowchart depicting the logic flow of configuring a selected serial communications port is illustrated therein. First, the software application or the user (not shown) selects a proper serial communications port. The port identifier designates to the port driver VxD which port has been selected. Upon initialization, the port driver VxD will read the configuration data of the initialized port including the time-stamp value from the system registry. The port driver VxD includes a time-stamp flag, a variable that indicates whether time-stamping is appropriate in accordance with the present invention.
If the time-stamp value in the system registry is 1, the time-stamp flag of the port driver VxD will be set to 1 to indicate a time-stamp will be attached to each character received. Otherwise, the time-stamp flag will be set to zero to indicate that a time-stamp will not be attached to each character received to allow the selected port to function normally.
The present invention significantly reduces timing-induced data stream errors inherent in conventional protected operating system-based serial communications.